<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<title>校园招聘</title>
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<link href="css/content.css" rel="stylesheet">
		<link href="css/footer.css" rel="stylesheet">
		<script type="text/javascript" src="js/jquery-3.4.1.js"></script>
		<script type="text/javascript" src="js/bootstrap.min.js"></script>
		<script type="text/javascript">
			if(${sessionScope.setflag1}==1){
				alert("修改成功");
			}else if(${sessionScope.setflag1}==0){
				alert("服务器繁忙，请稍后再试");
			}
		</script>
	</head>
	<body>	<c:remove var="setflag1"/>
		<!-- 导入导航栏 -->
		<jsp:include page="/common/header.jsp"></jsp:include>
		<!--内容-->
		<div class="big_content pt_33">
			<div class="content clearfix">
				<!--内容左-->
				<div class="content1_l">
					<div class="biaoti_01 clearfix">
						<div class="h11">公司信息</div>
					</div>
					<form class="wdmp_box clearfix" action="company/resetinfo " method="post"  enctype="multipart/form-data">
						<div class="biaoti_02 wdmp"><a>公司logo</a></div>
						<div class="touxiang clearfix">
							<img style="width:100px; height:100px; border-radius:50%;" src="<c:url value='images/${user.photo }'/>" id="avatar_img" />
							<div class="xm">${user.name}</div>
							<span id="setphoto"></span>
							<input type="hidden" name="id" value="${user.id }">
						</div>
						<div class="bianji">
							<img src="image/wodejianli/bianji.png" style="cursor: pointer;" onclick="resetphoto()" />
						</div>
						<div style="float:right;">
							<span id="botton1"></span>
						</div>
					</form>
					<form  class="qzyx_box clearfix" action="company/resetinfo " method="post"  enctype="multipart/form-data">
						<div class="biaoti_02 qzyx"><a>基本资料</a><span></span></div>
						<div class="qzyx_text clearfix">
							<div><span id="setname">公司名称：${user.name} </span></div>
							<div><span id="settitle">公司标题：${user.title} </span></div>
							
							<div><span id="setphone">联系方式：${user.phone }</span></div>

							<div><span id="setemail"> 常用邮箱：${user.email }</span></div>
							<input type="hidden" name="id" value="${user.id }">

						</div>
						<div class="bianji">
							<img src="image/wodejianli/bianji.png" style="cursor: pointer;" onclick="resetbase()" />
						</div>
						<div style="float:right;">
							<span id="botton2"></span>
						</div>
					</form>
					<form  class="qzyx_box clearfix" action="company/resetinfo " method="post"  enctype="multipart/form-data">
						<div class="biaoti_02 qzyx"><a>详细资料</a><span></span></div>
						<div class="qzyx_text clearfix">
							<input type="hidden" name="id" value="${user.id }">
							<div><span id="setlocation">公司地址：${user.location }</span></div>
							<div><span id="setcomtype">公司类型：${user.comtype }</span></div>
							<div><span id="setsum">公司规模：${user.sum }</span></div>
							<div><span id="settip">公司简介：${user.tip }</span></div>
						</div>
						<div class="bianji">
							<img src="image/wodejianli/bianji.png" style="cursor: pointer;" onclick="resetbase1()" />
						</div>
						<div style="float:right;">
							<span id="botton3"></span>
						</div>
					</form>
				</div>
			</div>
		</div>
		<!-- 导入底部信息 -->
		<jsp:include page="/common/footer.jsp"></jsp:include>

		<script type="text/javascript">
			function resetphoto() {
				document.getElementById("setphoto").innerHTML = "<input type='file' id='file' name='file' />"
				document.getElementById("botton1").innerHTML =
					"<input class='btn' type='submit' value='确认' />&nbsp;&nbsp;<input class='btn' type='button' value='取消' onclick='exit1()'/>"
			}

			function exit1() {
				document.getElementById("setphoto").innerHTML = ""
				document.getElementById("botton1").innerHTML = ""
			}

			function resetbase() {
				document.getElementById("setname").innerHTML = "公司名称：<input type='text' name='name'  placeholder='请输入名字'/>"
				document.getElementById("settitle").innerHTML ="公司宣传标题:<input type='text' name='title' placeholder='公司宣传标题' />"
				document.getElementById("setphone").innerHTML = "联系方式：<input type='text' name='phone' placeholder='联系方式' />"
				document.getElementById("setemail").innerHTML = "邮箱：<input type='text' name='email' placeholder='电子邮箱'/>"


				document.getElementById("botton2").innerHTML ="<input class='btn' type='submit' value='确认' />&nbsp;&nbsp;<input class='btn' type='button' value='取消' onclick='exit2()'/>"


			}

			function exit2() {
				document.getElementById("setname").innerHTML = "公司名称：${user.name} "
				document.getElementById("settitle").innerHTML = "公司标题：${user.title} "
				document.getElementById("setphone").innerHTML = "联系方式：${user.phone }"
				document.getElementById("setemail").innerHTML = "常用邮箱：${user.email }"

				document.getElementById("botton2").innerHTML = ""
			}

			function resetbase1() {
				document.getElementById("setlocation").innerHTML ="公司地址：<input name='location' type='text'  placeholder='公司地址'  />"
				document.getElementById("setcomtype").innerHTML = "公司类型：<select name='comtype' ><option selected>请选择</option><option>私企</option><option>国企</option><option>上市公司</option></select>"
				document.getElementById("setsum").innerHTML = "公司规模：<select name='sum'><option selected>请选择</option><option>少于15人</option><option>15-50人</option><option>50-150人</option><option>150-500人</option><option>500-2000人</option><option>2000人以上</option></select>"
				document.getElementById("settip").innerHTML ="公司简介：<textarea name='tip' >"

				document.getElementById("botton3").innerHTML ="<input class='btn' type='submit' value='确认' />&nbsp;&nbsp;<input class='btn' type='button' value='取消' onclick='exit3()'/>"


			}

			function exit3() {
				document.getElementById("setlocation").innerHTML ="公司地址：${user.location }"
				document.getElementById("setcomtype").innerHTML = "公司类型：${user.comtype }"
				document.getElementById("setsum").innerHTML ="公司规模：${user.sum }"
				document.getElementById("settip").innerHTML ="公司简介：${user.tip }"

				document.getElementById("botton3").innerHTML =""
				
			}












			// 个人头像预览
			$("#file").change(function() {
				// 获取上传文件对象
				var file = $(this)[0].files[0];
				// 读取文件URL
				var reader = new FileReader();
				reader.readAsDataURL(file);
				// 阅读文件完成后触发的事件
				reader.onload = function() {
					// 读取的URL结果：this.result
					$("#avatar_img").attr("src", this.result);
				}
			});
		</script>



	</body>
</html>
